package com.jixiang.goods.controller;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jixiang.model.common.dtos.ResponseResult;
import com.jixiang.model.goods.entity.GsGoodsBrank;
import com.jixiang.goods.service.GsGoodsBrankService;
import com.jixiang.model.goods.entity.GsGoodsType;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

/**
 * (GsGoodsBrank)表控制层
 *
 * @author makejava
 * @since 2023-10-21 16:44:03
 */
@RestController
@RequestMapping("goodsBrank")
public class GsGoodsBrankController extends ApiController {
    /**
     * 服务对象
     */
    @Resource
    private GsGoodsBrankService gsGoodsBrankService;

    @ApiOperation("管理端获取商品品牌")
    @GetMapping("/adminGetGoodsBrankList")
    public ResponseResult adminGetGoodsBrankList(){
        return ResponseResult.okResult(
                gsGoodsBrankService.query().orderByAsc("priority").list()
        );
    }

    @ApiOperation("添加商品品牌")
    @PostMapping("/addGoodsBrank")
    public ResponseResult addGoodsBrank(@RequestBody(required = true) GsGoodsBrank gsGoodsBrank){
        return gsGoodsBrankService.addGoodsBrank(gsGoodsBrank);
    }


    @ApiOperation("删除商品品牌")
    @DeleteMapping("/delGoodsBrankById")
    public ResponseResult delGoodsBrankById(@RequestParam(required = true,value = "id") String id){
//        boolean b = gsGoodsBrankService.removeById(id);
//        return ResponseResult.okResult("删除成功");
        return gsGoodsBrankService.delGoodsBrankById(id);
    }
}

